/*
 * Aboboo Android
 * Copyright (C) 2012 www.aboboo.com
 * 
 */
package com.aboboo.android.database;

import android.os.Parcelable;
import android.os.Parcel;

/**
 * 已下载到SD卡上的课件,保存课件信息到数据库
 * 
 * @author fangpeng
 * @version 2012-09-06
 * 
 */
public class DwCourseware implements Parcelable {

	// 课件的ID（Aboboo服务器）
	private int courseware_id;

	// 课件组ID
	private int group_id;
	// 课件组名
	private String group_name;

	// 课件名称
	private String name;

	// 一级分类
	private String class1;

	// 二级分类
	private String class2;

	// 保存到SD卡上的课件文件大小(byte)
	private int fileLength;

	// 下载地址
	private String download_url;

	// SD卡上的存储路径
	private String sd_filePath;

	// SD卡上的文件名称
	private String sd_fileName;

	// 下载日期
	private long dw_date;

	// 最近学习时间
	private long recent_study_date;

	// 默认构造函数
	public DwCourseware() {
	}

	public DwCourseware(int courseware_id, int group_id, String group_name,
			String name, String class1, String class2, int fileLength,
			String download_url, String sd_filePath, String sd_fileName,
			long dw_date, long recent_study_date) {
		// super();
		this.courseware_id = courseware_id;
		this.group_name = group_name;
		this.group_id = group_id;
		this.name = name;
		this.class1 = class1;
		this.class2 = class2;
		this.fileLength = fileLength;
		this.download_url = download_url;
		this.sd_filePath = sd_filePath;
		this.sd_fileName = sd_fileName;
		this.dw_date = dw_date;
		this.recent_study_date = recent_study_date;
	}

	public int getCourseware_id() {
		return courseware_id;
	}

	public void setCourseware_id(int courseware_id) {
		this.courseware_id = courseware_id;
	}

	public String getGroup_name() {
		return group_name;
	}

	public void setGroup_name(String group_name) {
		this.group_name = group_name;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getClass1() {
		return class1;
	}

	public void setClass1(String class1) {
		this.class1 = class1;
	}

	public String getClass2() {
		return class2;
	}

	public void setClass2(String class2) {
		this.class2 = class2;
	}

	public int getFileLength() {
		return fileLength;
	}

	public void setFileLength(int fileLength) {
		this.fileLength = fileLength;
	}

	public String getDownload_url() {
		return download_url;
	}

	public void setDownload_url(String download_url) {
		this.download_url = download_url;
	}

	public String getSd_filePath() {
		return sd_filePath;
	}

	public void setSd_filePath(String sd_filePath) {
		this.sd_filePath = sd_filePath;
	}

	public String getSd_fileName() {
		return sd_fileName;
	}

	public void setSd_fileName(String sd_fileName) {
		this.sd_fileName = sd_fileName;
	}

	public long getDw_date() {
		return dw_date;
	}

	public void setDw_date(long dw_date) {
		this.dw_date = dw_date;
	}

	public int getGroup_id() {
		return group_id;
	}

	public void setGroup_id(int group_id) {
		this.group_id = group_id;
	}

	public long getRecent_study_date() {
		return recent_study_date;
	}

	public void setRecent_study_date(long recent_study_date) {
		this.recent_study_date = recent_study_date;
	}

	@Override
	public String toString() {
		return "DwCourseware [courseware_id=" + courseware_id + ", group_id="
				+ group_id + ", group_name=" + group_name + ", name=" + name
				+ ", class1=" + class1 + ", class2=" + class2 + ", fileLength="
				+ fileLength + ", download_url=" + download_url
				+ ", sd_filePath=" + sd_filePath + ", sd_fileName="
				+ sd_fileName + ", dw_date=" + dw_date + ", recent_study_date="
				+ recent_study_date + "]";
	}

	public static final Parcelable.Creator<DwCourseware> CREATOR = new Creator<DwCourseware>() {

		@Override
		public DwCourseware createFromParcel(Parcel source) {
			DwCourseware cw = new DwCourseware();
			cw.courseware_id = source.readInt();
			cw.group_name = source.readString();
			cw.group_id = source.readInt();
			cw.name = source.readString();
			cw.class1 = source.readString();
			cw.class2 = source.readString();
			cw.fileLength = source.readInt();
			cw.download_url = source.readString();
			cw.sd_fileName = source.readString();
			cw.sd_filePath = source.readString();
			cw.dw_date = source.readLong();
			cw.recent_study_date = source.readLong();
			return cw;
		}

		@Override
		public DwCourseware[] newArray(int size) {
			return new DwCourseware[size];
		}

	};

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(courseware_id);
		dest.writeString(group_name);
		dest.writeInt(group_id);
		dest.writeString(name);
		dest.writeString(class1);
		dest.writeString(class2);
		dest.writeInt(fileLength);
		dest.writeString(download_url);
		dest.writeString(sd_fileName);
		dest.writeString(sd_filePath);
		dest.writeLong(dw_date);
		dest.writeLong(recent_study_date);
	}
}
